package java51_0607;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Scanner;

//输入一个文本文件名，统计有多少行。

public class NumLineTest {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入读取的文件名：");
		String s = sc.nextLine();
		BufferedReader br = null;
		int count = 0;
		try {
			br = new BufferedReader(new FileReader(s));
			while (br.readLine() != null) {
				// String st = br.readLine();
				// System.out.println(st);
				count++;
			}
			System.out.println("总行数：" + count);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
